3.1.39 \(\int \frac {\sec ^2(x)}{a+b \cos ^2(x)} \, dx\) [39]

Optimal. Leaf size=37 \[ \frac {b \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {\tan (x)}{a} \]

[Out]

b*arctan(cot(x)*(a+b)^(1/2)/a^(1/2))/a^(3/2)/(a+b)^(1/2)+tan(x)/a

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3266, 464, 211} \begin {gather*} \frac {b \text {ArcTan}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {\tan (x)}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sec[x]^2/(a + b*Cos[x]^2),x]

[Out]

(b*ArcTan[(Sqrt[a + b]*Cot[x])/Sqrt[a]])/(a^(3/2)*Sqrt[a + b]) + Tan[x]/a

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 3266

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeF
actors[Tan[e + f*x], x]}, Dist[ff^(m + 1)/f, Subst[Int[x^m*((a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p +
 1)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {\sec ^2(x)}{a+b \cos ^2(x)} \, dx &=-\text {Subst}\left (\int \frac {1+x^2}{x^2 \left (a+(a+b) x^2\right )} \, dx,x,\cot (x)\right )\\ &=\frac {\tan (x)}{a}+\frac {b \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\cot (x)\right )}{a}\\ &=\frac {b \tan ^{-1}\left (\frac {\sqrt {a+b} \cot (x)}{\sqrt {a}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {\tan (x)}{a}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.09, size = 38, normalized size = 1.03 \begin {gather*} -\frac {b \text {ArcTan}\left (\frac {\sqrt {a} \tan (x)}{\sqrt {a+b}}\right )}{a^{3/2} \sqrt {a+b}}+\frac {\tan (x)}{a} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sec[x]^2/(a + b*Cos[x]^2),x]

[Out]

-((b*ArcTan[(Sqrt[a]*Tan[x])/Sqrt[a + b]])/(a^(3/2)*Sqrt[a + b])) + Tan[x]/a

________________________________________________________________________________________

Maple [A]
time = 0.13, size = 33, normalized size = 0.89

method result size
default \(\frac {\tan \left (x \right )}{a}-\frac {b \arctan \left (\frac {a \tan \left (x \right )}{\sqrt {\left (a +b \right ) a}}\right )}{a \sqrt {\left (a +b \right ) a}}\) \(33\)
risch \(\frac {2 i}{a \left ({\mathrm e}^{2 i x}+1\right )}-\frac {b \ln \left ({\mathrm e}^{2 i x}+\frac {-2 i a^{2}-2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, a}+\frac {b \ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, a}\) \(181\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(x)^2/(a+b*cos(x)^2),x,method=_RETURNVERBOSE)

[Out]

tan(x)/a-1/a*b/((a+b)*a)^(1/2)*arctan(a*tan(x)/((a+b)*a)^(1/2))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 32, normalized size = 0.86 \begin {gather*} -\frac {b \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{\sqrt {{\left (a + b\right )} a} a} + \frac {\tan \left (x\right )}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(a+b*cos(x)^2),x, algorithm="maxima")

[Out]

-b*arctan(a*tan(x)/sqrt((a + b)*a))/(sqrt((a + b)*a)*a) + tan(x)/a

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (29) = 58\).
time = 0.42, size = 216, normalized size = 5.84 \begin {gather*} \left [-\frac {\sqrt {-a^{2} - a b} b \cos \left (x\right ) \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} - 4 \, {\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{3} - a \cos \left (x\right )\right )} \sqrt {-a^{2} - a b} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right ) - 4 \, {\left (a^{2} + a b\right )} \sin \left (x\right )}{4 \, {\left (a^{3} + a^{2} b\right )} \cos \left (x\right )}, \frac {\sqrt {a^{2} + a b} b \arctan \left (\frac {{\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a}{2 \, \sqrt {a^{2} + a b} \cos \left (x\right ) \sin \left (x\right )}\right ) \cos \left (x\right ) + 2 \, {\left (a^{2} + a b\right )} \sin \left (x\right )}{2 \, {\left (a^{3} + a^{2} b\right )} \cos \left (x\right )}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(a+b*cos(x)^2),x, algorithm="fricas")

[Out]

[-1/4*(sqrt(-a^2 - a*b)*b*cos(x)*log(((8*a^2 + 8*a*b + b^2)*cos(x)^4 - 2*(4*a^2 + 3*a*b)*cos(x)^2 - 4*((2*a +
b)*cos(x)^3 - a*cos(x))*sqrt(-a^2 - a*b)*sin(x) + a^2)/(b^2*cos(x)^4 + 2*a*b*cos(x)^2 + a^2)) - 4*(a^2 + a*b)*
sin(x))/((a^3 + a^2*b)*cos(x)), 1/2*(sqrt(a^2 + a*b)*b*arctan(1/2*((2*a + b)*cos(x)^2 - a)/(sqrt(a^2 + a*b)*co
s(x)*sin(x)))*cos(x) + 2*(a^2 + a*b)*sin(x))/((a^3 + a^2*b)*cos(x))]

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec ^{2}{\left (x \right )}}{a + b \cos ^{2}{\left (x \right )}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)**2/(a+b*cos(x)**2),x)

[Out]

Integral(sec(x)**2/(a + b*cos(x)**2), x)

________________________________________________________________________________________

Giac [A]
time = 0.42, size = 36, normalized size = 0.97 \begin {gather*} -\frac {b \arctan \left (\frac {a \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )}{\sqrt {a^{2} + a b} a} + \frac {\tan \left (x\right )}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(x)^2/(a+b*cos(x)^2),x, algorithm="giac")

[Out]

-b*arctan(a*tan(x)/sqrt(a^2 + a*b))/(sqrt(a^2 + a*b)*a) + tan(x)/a

________________________________________________________________________________________

Mupad [B]
time = 2.38, size = 30, normalized size = 0.81 \begin {gather*} \frac {\mathrm {tan}\left (x\right )}{a}-\frac {b\,\mathrm {atan}\left (\frac {\sqrt {a}\,\mathrm {tan}\left (x\right )}{\sqrt {a+b}}\right )}{a^{3/2}\,\sqrt {a+b}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(cos(x)^2*(a + b*cos(x)^2)),x)

[Out]

tan(x)/a - (b*atan((a^(1/2)*tan(x))/(a + b)^(1/2)))/(a^(3/2)*(a + b)^(1/2))

________________________________________________________________________________________